package com.karolak.stock.indicator;

import com.karolak.stock.data.DataManager;

public class Indicator {

	private String name;
	private int period;
	private DataManager dataManager;
	private Indicator input;

	public Indicator(String name, DataManager dataManager) {
		this(dataManager, 0, null);
		setName(name);
	}

	public Indicator(String name, DataManager dataManager, int period) {
		this(dataManager, period, null);
		setName(name);
	}

	public Indicator(String name, DataManager dataManager, int period, Indicator input) {
		this(dataManager, period, input);
		setName(name);
	}

	public Indicator(DataManager dataManager, int period, Indicator input) {
		this.dataManager = dataManager;
		this.period = period;
		this.input = input;
		String name = getClass().getSimpleName();
		name = name.endsWith("Ind") ? name.replace("Ind", "") : name;
		setName(name);
	}

	public double execute(double x) {
		return x;
	}

	// === get/set === //
	protected DataManager getDataManager() {
		return dataManager;
	}

	protected int getPeriod() {
		return period;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Indicator getInput() {
		return input;
	}
}
